/**
 * 温度计
 */
Temp = Widget.extend({
	ctor:function(parent){
		this._super();
		parent.addChild(this,19);
		this.setTag(TAG_TEMP);
		this.init();
	},
	init : function(){
		this.setVisible(false);
		this.setCascadeOpacityEnabled(true);
		//温度计--左边
		var temp_left1 = new Button(this, 10, TAG_TEMP_LEFT1, "#run/temp1.png",this.callback);
		temp_left1.setPosition(cc.p(462,485));
		temp_left1.setScale(0.6);
		var temp_left2 = new Button(this, 10, TAG_TEMP_LEFT2, "#run/temp2.png",this.callback);
		temp_left2.setPosition(cc.p(462,333));
		temp_left2.setScale(0.7);
		//温度计--右边
		var temp_right = new Button(this, 10, TAG_TEMP_RIGHT, "#lib/temperature.png",this.callback);
		temp_right.setPosition(cc.p(870,469));
		temp_right.setScale(0.6);
	},
	tempBuddle :function(){
		var bubble = new cc.Sprite("#run/bubble.png");
		this.addChild(bubble,11);
		bubble.setPosition(cc.p(464,320));
		bubble.setOpacity(0);
		bubble.runAction(cc.sequence(cc.fadeIn(2),cc.moveTo(6, cc.p(464,336))));
	},
	callback:function(p){
		switch(p.getTag()){
		case TAG_TEMP_LEFT1:
			var word = this.getParent().getChildByTag(TAG_DENGZHILIANG);
			word.removeFromParent();
			var tempSp1 = new cc.Sprite("#run/tempSp_left.png");
			this.addChild(tempSp1,2,TAG_TEMP_SP1);
			tempSp1.setPosition(cc.p(589,485));
			tempSp1.runAction(cc.sequence(cc.delayTime(0.5),cc.callFunc(function() {
				gg.flow.next();
			}, this)));
			//下半部模糊的线
			var line1_1 = new cc.Sprite("#run/tempLine1.png");
			line1_1.setRotation(90);
			line1_1.setScale(1, 4);
			line1_1.setAnchorPoint(1, 0.5);
			tempSp1.addChild(line1_1);
			line1_1.setPosition(cc.p(76,43));
			//上半部可延长
			var line1_2 = new cc.Sprite("#run/tempLine2.png");
			line1_2.setRotation(90);
			line1_2.setScale(0.25, 4);
			line1_2.setAnchorPoint(1, 0.5);
			tempSp1.addChild(line1_2, 2, TAG_TEMP_LINE1);
			line1_2.setPosition(cc.p(76,79));
			break;
		case TAG_TEMP_RIGHT:
			var show = new ShowTip("水与砂石的\n 温度相同",cc.p(578,240));	
			var tempSp2 = new cc.Sprite("#run/tempSp_right.png");
			this.addChild(tempSp2,2,TAG_TEMP_SP2);
			tempSp2.setPosition(cc.p(742,485));
			tempSp2.runAction(cc.sequence(cc.delayTime(0.5),cc.callFunc(function() {
				gg.flow.next();
			}, this)));
			//下半部模糊的线
			var line2_1 = new cc.Sprite("#run/tempLine1.png");
			line2_1.setRotation(90);
			line2_1.setScale(1, 4);
			line2_1.setAnchorPoint(1, 0.5);
			tempSp2.addChild(line2_1);
			line2_1.setPosition(cc.p(76,43));
			//上半部可延长
			var line2_2 = new cc.Sprite("#run/tempLine2.png");
			line2_2.setRotation(90);
			line2_2.setScale(0.25, 4);
			line2_2.setAnchorPoint(1, 0.5);
			tempSp2.addChild(line2_2, 2, TAG_TEMP_LINE2);
			line2_2.setPosition(cc.p(76,79));
			break;
		}
	}
});
